import { ColorList } from '@/store/constant'
import duration from 'dayjs/plugin/duration'
dayjs.extend(duration)
// 排班基础信息组件
interface Props {
  item: any
  index: number
}

const ShiftItemCell = ({ item, index }: Props) => {
  const color = ColorList[index % ColorList.length]
  return (
    <>
      <ListItemText
        primary={
          <Typography color={color[800]} variant="body1">
            {item.shift_id}
          </Typography>
        }
        secondary={
          <Typography variant="h4">
            {getShiftTime(item.start_delta)}-{getShiftTime(item.end_delta)}
          </Typography>
        }
      />
    </>
  )
}
export default ShiftItemCell

function getShiftTime(value = 0) {
  return dayjs.duration(value).format('HH:mm')
}
